<?php  

require('libs/Smarty/libs/Smarty.class.php');

class View {

    private $smarty; 
    
    public function __construct()
    {
        // quando entao for chamado o contrutor da 
        // classe, ele instancia o objeto Smarty
        $this->smarty = new Smarty();
        
        $this->smarty->setTemplateDir("libs/Smarty/templates");
        $this->smarty->setCompileDir('libs/Smarty/templates_c'); 
        $this->smarty->setCacheDir('libs/Smarty/cache'); 
        $this->smarty->setConfigDir('libs/Smarty/configs'); 
                
        $this->smarty->debugging = true;
        $this->smarty->caching = true;
        $this->smarty->cache_lifetime = 120;
    }

    public function mostrarNaTela($template)
    {
        // chama o metodo do smarty pra exibir o 
        // template na tela
        $this->smarty->display($template); 
    }

    public function atribuirValor($var, $valor)
    {
        // chama o metodo do smarty para atribuir 
        // o valor a variavel
        $this->smarty->assign($var, $valor);
    }
}

?>